﻿
Partial Class _Default
    Inherits System.Web.UI.Page
    Private curcon As Data.SqlClient.SqlConnection
    Private Function Connect(ByRef Con As System.Data.SqlClient.SqlConnection) As Integer


        Con.ConnectionString = ConfigurationManager.ConnectionStrings("[MyConn]").ToString()
        tryClose()
        Try

            Con.Open()
            curcon = Con


            Return 1
        Catch
            Return 0

        End Try

    End Function

    Private Sub tryClose()
        Try
            curcon.Close()

        Catch ex As Exception

        End Try
    End Sub

    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Dim Con As New System.Data.SqlClient.SqlConnection
        Response.Write("Database Connectivity: " + Connect(Con).ToString + " IF THIS PROBLEM PERSISTS, RESPONSIBLE IS SERVER OWNER, CHANGE YOUR SERVER ADDRESS, TRY FILE IN YOUR OWN SERVER TOO")
        tryClose()
    End Sub
End Class
